import type { TableColumn } from '@/framework/components/core/super-table';

/**
 * columns
 */
export type TableListItem = {
  id;
  createTime;
  creatorName;
  path;
  size;
};
export type TableColumnItem = TableColumn<TableListItem>;

export const baseColumns: TableColumnItem[] = [
  {
    type: 'seq',
    title: '序号',
    width: 60,
  },
  {
    title: '备份时间',
    field: 'createTime',
    searchField: 'createTimeBtw',
    formItemProps: {
      component: 'RangePicker',
      componentProps: {
        valueFormat: 'YYYY-MM-DD',
      },
    },
  },
  {
    title: '备份人',
    field: 'creatorName',
    hideInSearch: true,
  },
  {
    title: '备份文件',
    field: 'path',
    hideInSearch: true,
  },
  {
    title: '大小',
    field: 'size',
    formatter: ({ cellValue }) => {
      return cellValue ? `${(cellValue / 1024 / 1024).toFixed(2)}M` : '';
    },
    hideInSearch: true,
  },
];
